import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:shenling_flutter/pages/task/tabs/tabs1.dart';
import 'package:shenling_flutter/pages/task/tabs/tabs2.dart';
import 'package:shenling_flutter/pages/task/tabs/tabs3.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: TaskPage(),
    );
  }
}

class TaskPage extends StatefulWidget {
  const TaskPage({super.key});

  @override
  State<TaskPage> createState() => _TaskPageState();
}

class _TaskPageState extends State<TaskPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          toolbarHeight: 10, // 改变 AppBar 的高度
          bottom: PreferredSize(
            preferredSize: Size.fromHeight(40), // 改变 TabBar 的高度
            child: TabBar(
              labelColor: Colors.black,
              labelStyle: const TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.bold,
              ),
              unselectedLabelColor: Colors.black,
              unselectedLabelStyle: const TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.normal,
              ),
              indicatorWeight: 2,
              indicator: UnderlineTabIndicator(
                borderRadius: BorderRadius.circular(10),
                borderSide: const BorderSide(
                  width: 5,
                  color: Colors.red,
                ),
                insets: const EdgeInsets.only(bottom: 5, left: 10, right: 10),
              ),
              dividerColor: Colors.transparent,
              tabs: const [
                Tab(text: '待提货'),
                Tab(text: '在途中'),
                Tab(text: '已完成'),
              ],
            ),
          ),
        ),
        body: const TabBarView(
          children: [ToBeGetPage(), GoPage(), GetPage()],
        ),
      ),
    );
  }
}
